<?php 
/*
* 侧边栏组件、页面模块
*/
if(!defined('EMLOG_ROOT')) {exit('error!');} 
?>
<?php
/**
 * 压缩html : 清除换行符,清除制表符,去掉注释标记  
 * @param   $string  http://yi1.com.cn/posts/641
 * @return  压缩后的$string 
 * */
function compress_html($string) {  
    $string = str_replace(array("\n","\t","\r\n"), '', $string);
    $pattern = array(  
                    "/> *([^ ]*) *</", //去掉注释标记  
                    "/[\s]+/",  
                    "/<!--[^!]*-->/",  
                    //"/\" /",  
                    //"/ \"/",  
                    "'/\*[^*]*\*/'" 
                    );  
    $replace = array(  
                    ">\\1<",  
                    " ",  
                    "",  
                    "\"",  
                    "\"",  
                    "" 
                    );  
    return trim(preg_replace($pattern, $replace, $string));  
} 
?>
<?php
//widget：blogger
function widget_blogger($title){
	global $CACHE;
	$user_cache = $CACHE->readCache('user');
	$name = $user_cache[1]['mail'] != '' ? "<a href=\"mailto:".$user_cache[1]['mail']."\">".$user_cache[1]['name']."</a>" : $user_cache[1]['name'];?>
	<a name="blogger"></a>
	<div class="cbx">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx">
	<ul id="bloggerinfo">
                <a href="<?php echo BLOG_URL.$user_cache[1]['photo']['src']; ?>" title="点击查看大图"><img src="<?php echo BLOG_URL.$user_cache[1]['photo']['src']; ?>" width="100%" height="100%" alt=""></a>
                <p>名字:<?php echo $name; ?><br/>邮箱:<a href="mailto:<?php echo $user_cache[1]['mail']; ?>" target="_self" title="点击发送邮件到 <?php echo $user_cache[1]['mail']; ?>"><?php echo $user_cache[1]['mail']; ?></a></p>
            =-=-=-=-=-=-=-=-=-=-=-=-=-=-=<br/><p><?php echo $user_cache[1]['des']; ?></p>
	</ul>
	</div>
	</div>
<?php }?>
<?php
//widget：日历
function widget_calendar($title){ ?>
	<div class="cbx">
	<h3><span><?php echo $title; ?></span></h3>
	<div id="calendar">
	</div>
	<script>sendinfo('<?php echo Calendar::url(); ?>','calendar');</script>
	</div>
<?php }?>
<?php
//plus：随机彩色标签
function randtagbk() {
	$rand1 = array('primary','warning','success','info');
	$rand2 = array_rand($rand1);
	return $rand1[$rand2];
}
//widget：标签
function widget_tag($title){
	global $CACHE;
	$tag_cache = $CACHE->readCache('tags');?>
	<a name="alltag"></a>
	<div class="cbx">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx"><ul style="line-height:30px;">
	<?php $ksn=0;
	foreach($tag_cache as $value): ?>
		<a href="<?php echo Url::tag($value['tagurl']); ?>" class="btn btn-<?php echo randtagbk(); ?> btn-xs" title="<?php echo $value['usenum']; ?> 篇日志" style="color:#FFFFFF;"><?php echo $value['tagname']; ?></a>
	&nbsp;<?php endforeach; ?></ul>
	</div>
	</div>
<?php }?>
<?php
//widget：分类
function widget_sort($title){
	global $CACHE;
	$sort_cache = $CACHE->readCache('sort'); ?>
	<div class="cbx list2">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx">
	<ul id="blogsort">
	<?php foreach($sort_cache as $value): ?>
	<li>
	<a href="<?php echo Url::sort($value['sid']); ?>"><?php echo $value['sortname']; ?>(<?php echo $value['lognum'] ?>)</a>
	</li>
	<?php endforeach; ?>
	</ul>
	</div>
	</div>
<?php }?>
<?php
//widget：最新碎语
function widget_twitter($title){
	global $CACHE; 
	$newtws_cache = $CACHE->readCache('newtw');
	$istwitter = Option::get('istwitter');
	?>
	<div class="cbx">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx">
	<ul id="twitter">
	<?php foreach($newtws_cache as $value): ?>
	<li><?php echo $value['t']; ?><p><?php echo smartDate($value['date']); ?> </p></li>
	<?php endforeach; ?>
    <?php if ($istwitter == 'y') :?>
	<p><a href="<?php echo BLOG_URL . 't/'; ?>">查看更多碎语&raquo;</a></p>
	<?php endif;?>
	</ul>
	</div>
	</div>
<?php }?>
<?php
//widget：最新评论
function widget_newcomm($title){
	global $CACHE; 
	$com_cache = $CACHE->readCache('comment');
	?>
	<div class="cbx" id="recent-comments">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx">
	<ul id="newcomment">
	<?php
	foreach($com_cache as $value):
	$url = Url::comment($value['gid'], $value['page'], $value['cid']);
	?>
	<li id="comment">
	<a href="<?php echo $url; ?>"><span class="comer"><?php echo $value['name']; ?> : </span><?php echo $value['content']; ?></a></li>
	<?php endforeach; ?>
	</ul>
	</div>
	</div>
<?php }?>
<?php
//widget：最新日志
function widget_newlog($title){
	global $CACHE; 
	$newLogs_cache = $CACHE->readCache('newlog');
	?>
	<div class="cbx">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx">
	<ul id="newlog">
	<?php foreach($newLogs_cache as $value): ?>
	<li><a href="<?php echo Url::log($value['gid']); ?>"><?php echo $value['title']; ?></a></li>
	<?php endforeach; ?>
	</ul>
	</div>
	</div>
<?php }?>
<?php
//widget：随机日志
function widget_random_log($title){
	$index_randlognum = Option::get('index_randlognum');
	$Log_Model = new Log_Model();
	$randLogs = $Log_Model->getRandLog($index_randlognum);?>
	<div class="cbx">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx">
	<ul id="randlog">
	<?php foreach($randLogs as $value): ?>
	<li><a href="<?php echo Url::log($value['gid']); ?>"><?php echo $value['title']; ?></a></li>
	<?php endforeach; ?>
	</ul>
	</div>
	</div>
<?php }?>
<?php
//widget：搜索
function widget_search($title){ ?>
	<div class="cbx">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx">
	<ul id="logserch">
	<form name="keyform" method="get" action="<?php echo BLOG_URL; ?>index.php">
	<input class="form-control" name="keyword"  type="search" value="" style="width:100%;" placeholder="输入关键词" autocomplete="on" x-webkit-speech speech />
	<br/><br/><input type="submit" id="logserch_logserch" class="btn btn-primary" style="width:100%" value="点击此处搜索" /><br/><br/>
	<p>注意：该简易搜索 仅支持搜索指定关键词，并且需要完全相符</p>
	</form>
	</ul>
	</div>
	</div>
<?php } ?>
<?php
//widget：归档
function widget_archive($title){
	global $CACHE; 
	$record_cache = $CACHE->readCache('record');
	?>
	<div class="cbx">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx ">
	<ul id="record">
	<?php /*
	<?php foreach($record_cache as $value): ?>
	<li><a href="<?php echo Url::record($value['date']); ?>"><?php echo $value['record']; ?>(<?php echo $value['lognum']; ?>)</a></li>
	<?php endforeach; ?> */ ?>
	
	查看存档：<select name="torecord"  size="1" onchange="recordload.style.display='';window.location=this.value;" style="width:160px"><option value="javascript:;">请选择文章存档</option>
	<?php foreach($record_cache as $value): ?>
	<li><option value="<?php echo Url::record($value['date']); ?>"><?php echo $value['record']; ?>(<?php echo $value['lognum']; ?>)</option></li>
	<?php endforeach; ?></select>
	<div id="recordload" style="display:none;"><br/><img src="<?php echo IMG_URL; ?>loading.gif"> 正在载入指定存档中...</div>
	
	<br/><br/><p><a style="font-size:117%;" href="<?php BLOG_URL ;?>?post=0">查看评论合集 &raquo;</a></p>
	</ul>
	</div>
	</div>
<?php } ?>
<?php
//widget：自定义组件
function widget_custom_text($title, $content){ ?>
	<div class="cbx">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx">
	<ul>
	<?php echo $content; ?>
	</ul>
	</div>
	</div>
<?php } ?>
<?php
//widget：链接 [ 支持随机 ]

function widget_link($title){
if('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == BLOG_URL or 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == BLOG_URL.'index.php') {
	global $CACHE; 
	$link_cache = $CACHE->readCache('link');
	?>
	<div class="cbx list2">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx">
	<ul id="link">
	<?php shuffle($link_cache);
	foreach($link_cache as $value): ?>
	<li><a href="<?php echo $value['url']; ?>" title="<?php echo $value['des']; ?>" target="_blank"><?php echo $value['link']; ?></a></li>
	<?php endforeach; ?>
	</ul>
	</div>
	</div>
<?php } }  ?>

<?php
//widget：链接 无随机
/*
function widget_link($title){
if('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == BLOG_URL or 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == BLOG_URL.'index.php') {
	global $CACHE; 
	$link_cache = $CACHE->readCache('link');
	?>
	<div class="cbx list2">
	<h3><span><?php echo $title; ?></span></h3>
	<div class="ctx">
	<ul id="link">
	<?php foreach($link_cache as $value): ?>
	<li><a href="<?php echo $value['url']; ?>" title="<?php echo $value['des']; ?>" target="_blank"><?php echo $value['link']; ?></a></li>
	<?php endforeach; ?>
	</ul>
	</div>
	</div>
<?php } }  */?>


<?php
//blog：置顶
function topflg($istop){
	$topflg = $istop == 'y' ? "<img src=\"".IMG2_URL."import.gif\" title=\"置顶日志\" /> " : '';
	echo $topflg;
}
?>
<?php
//blog：编辑
function editflg($logid,$author){
	$editflg = ROLE == 'admin' || $author == UID ? '<a href="'.BLOG_URL.'admin/write_log.php?action=edit&gid='.$logid.'">编辑</a>' : '';
	echo $editflg;
}
?>
<?php
//blog：导航
function blog_navi($mob = false){
	global $CACHE; 
	$navi_cache = $CACHE->readCache('navi');
	$pp= $mob == true ? 'class="btn btn-link"' : '';
	?>
	<?php 
	foreach($navi_cache as $value):
		$newtab = $value['newtab'] == 'y' ? 'target="_blank"' : '';
		$value['url'] = $value['isdefault'] == 'y' ? BLOG_URL . $value['url'] : trim($value['url'], '/');
		$current_tab = (BLOG_URL . trim(Dispatcher::setPath(), '/') == $value['url']) ? 'current' : 'common';
		?>
		<li><a href="<?php echo $value['url']; ?>" <?php echo $newtab; echo ' '.$pp;?>><?php echo $value['naviname']; ?></a></li>
	<?php endforeach; 
$Log_Model = new Log_Model();
$randLogs = $Log_Model->getRandLog(1);  //1为随机数量
if (ROLE == 'admin') {
	echo '<li><a href="'.BLOG_URL.'admin">管理中心</a></li>';
}
foreach($randLogs as $v) {
echo '<li><a href="'.Url::log($v['gid']).'" title="点我吧，点我吧！我能随机给你找一篇好看的文章！" '.$pp.'>随便看看</a></li>';
}
unset($v);
?>
<?php }?>
<?php
//blog：分类
function blog_sort($blogid,$echodata = true){
	global $CACHE; 
	$log_cache_sort = $CACHE->readCache('logsort');
	?>
	<?php if(!empty($log_cache_sort[$blogid])): 
	if($echodata == true) { echo '分类：';}
	?>
	<a href="<?php echo Url::sort($log_cache_sort[$blogid]['id']); ?>"><?php echo $log_cache_sort[$blogid]['name']; ?></a>
	<?php endif;?>
<?php }?>
<?php
//blog：文件附件
function blog_att($blogid){
	global $CACHE;
	$log_cache_atts = $CACHE->readCache('logatts');
	$att = '';
	if(!empty($log_cache_atts[$blogid])){
		$att .= '附件下载：';
		foreach($log_cache_atts[$blogid] as $val){
			$att .= '<br /><a href="'.BLOG_URL.$val['url'].'" target="_blank">'.$val['filename'].'</a> '.$val['size'];
		}
	}
	echo $att;
}
?>
<?php
//blog：日志标签
function blog_tag($blogid,$inlog = false){
	global $CACHE;
	$log_cache_tags = $CACHE->readCache('logtags');
	if (!empty($log_cache_tags[$blogid])){
		if ($inlog == false) {
			$tag = '标签:';
			foreach ($log_cache_tags[$blogid] as $value){
			$tag .= "&nbsp;&nbsp;<a href=\"".Url::tag($value['tagurl'])."\">".$value['tagname'].'</a>';
		} } else {
			$tag = '<span class="class="badge">本文标签</span>：' ;
			foreach ($log_cache_tags[$blogid] as $value){
			$tag .= "&nbsp;&nbsp;<a href=\"".Url::tag($value['tagurl'])."\" class=\"label label-".randtagbk()."\" style=\"color:white;\">".$value['tagname'].'</a>';
		} }
		echo $tag;
	}
}
?>
<?php
//blog：日志作者
function blog_author($uid){
	global $CACHE;
	$user_cache = $CACHE->readCache('user');
	$author = $user_cache[$uid]['name'];
	$mail = $user_cache[$uid]['mail'];
	$des = $user_cache[$uid]['des'];
	$title = !empty($mail) || !empty($des) ? "title=\"$des $mail\"" : '';
	echo '<a href="'.Url::author($uid)."\" $title>$author</a>";
}
?>
<?php
//blog：相邻日志
function neighbor_log($neighborLog){
	extract($neighborLog);?>
	<?php if($prevLog):?>
	<span class="prev"> <a href="<?php echo Url::log($prevLog['gid']) ?>"><?php echo $prevLog['title'];?></a></span>
	<?php endif;?>
	<?php if($nextLog):?>
	<span class="next"><a href="<?php echo Url::log($nextLog['gid']) ?>"><?php echo $nextLog['title'];?></a></span>
	<?php endif;?>
<?php }?>
<?php
//blog：引用通告
function blog_trackback($tb, $tb_url, $allow_tb){
    if($allow_tb == 'y' && Option::get('istrackback') == 'y'):?>
    <a name="tb"></a>
    <div class="writerinfodiv input-group">
	<span class="input-group-addon">引用地址</span>
	<input type="url" class="form-control" id="x_this_tburl" value="<?php echo $tb_url; ?>" >
	<span class="input-group-addon" onclick="wmzz_copy(document.getElementById('x_this_tburl').value);">复制引用地址</span>
	</div>
	<?php endif; ?>
	<?php foreach($tb as $key=>$value):?>
		<ul id="trackback">
		<li><a href="<?php echo $value['url'];?>" target="_blank"><?php echo $value['title'];?></a></li>
		<li>BLOG: <?php echo $value['blog_name'];?></li><li><?php echo $value['date'];?></li>
		</ul>
	<?php endforeach; ?>
<?php }?>
<?php
//blog：博客评论列表
function blog_comments($comments){
    extract($comments);
    if($commentStacks): $commnum = count($comments);
?>
	<a name="comments"></a>
	<div id="commnents" class="commentsorping">
		<div class="commentsays">已经有<?php echo $commnum; ?>个回复 | <a onclick="go('comment-post');" href="#comment_post">发表评论</a></div>
		<div class="clear"></div>
	</div>
	
	<?php endif; ?>
	<div class="commentshow" style="display: block;">
	<?php
	$isGravatar = Option::get('isgravatar');
	$comm_i = count($comment);
	foreach($commentStacks as $cid):
    $comment = $comments[$cid];
	$comment['poster'] = base64_encode($comment['url']) ? '<a href="'.BLOG_URL.'url.php?url='.base64_encode($comment['url']).'&b64=on" target="_blank" rel="external nofollow">'.$comment['poster'].'</a>' : $comment['poster'];
	?>
	<a name='<?php echo $comment['cid']; ?>'></a>
	<ol class="commentlist">
		<li id="comment-<?php echo $comment['cid']; ?>">
			<div class="comment-body">
				<div class="commenttext">
					<?php if($isGravatar == 'y'): ?><div class="gravatar"><img phzoom="yes" width="32" height="32" src="<?php echo getGravatar($comment['mail']); ?>" /></div><?php endif; ?>
					<div class="comment-meta">
						<span class="commentid"> <?php echo $comment['poster']; ?> </span>
						<span class="commenttime"> ( <?php echo $comment['date']; ?> ) <?php if(function_exists('display_useragent')){display_useragent($comment['cid']);} //UserAgent 插件?>　<a href="javascript:;" onclick="wa('Cid:<?php echo $comment['cid'] ; ?><br/>Pid:<?php echo $comment['pid'] ; ?><br/>Gid:<?php echo $comment['gid']; ?>','评论ID信息');">查询ID</a> | <a href="javascript:;" onclick="commentReply(<?php echo $comment['cid']; ?>,this);comcrmsg.style.display='';" style="color:red;">回复此评论</a> </span>
						<span class="commentidnext"> : </span>
					</div>
					<div class="commentp">
							<?php echo html_entity_decode($comment['content'],ENT_QUOTES,'UTF-8'); ?>
						<span class="reply"> <a class="comment-reply-link" onclick="commentReply(<?php echo $comment['cid']; ?>,this);comcrmsg.style.display='';">回复</a> </span>
					</div>
				</div>
				<div class="clearline"></div>
			</div>
			<?php blog_comments_children($comments, $comment['children']); ?>
		</li>
	</ol>
	<?php endforeach; ?>
    <div id="pagenavi" class="pagenavi">
	    评论分页：<?php echo $commentPageUrl;?>
    </div>
	</div><!--end commentshow-->
<?php }?>
<?php
//blog：博客子评论列表
function blog_comments_children($comments, $children){
	$isGravatar = Option::get('isgravatar');
	foreach($children as $child):
	$comment = $comments[$child];
	$CACHE = Cache::getInstance();
	$user_cache = $CACHE->readCache('user');
	if (!empty($comment['poster'])) {
	     $comment['posterX'] = base64_encode($comment['url']) ? '<a href="'.BLOG_URL.'url.php?url='.base64_encode($comment['url']).'&b64=on" target="_blank" rel="external nofollow">'.$comment['poster'].'</a>' : $comment['poster'];
	 } else {
	     $comment['posterX'] = "游客";
	}
	?>
	<a name='<?php echo $comment['cid']; ?>'></a>
	<ul class="children">
		<li id="comment-<?php echo $comment['cid']; ?>" class="comment">
			<div class="comment-body">
				<div class="commenttext">
					<?php if($isGravatar == 'y'): ?><div class="gravatar"><img width="32" height="32" src="<?php echo getGravatar($comment['mail']); ?>" /></div><?php endif; ?>
					<div class="comment-meta">
						<span class="commentid"> <?php echo $comment['posterX']; ?> </span>
						<span class="commenttime"> ( <?php echo $comment['date']; ?> ) <?php if(function_exists('display_useragent')){display_useragent($comment['cid']);} //UserAgent 插件?>　<a href="javascript:;" onclick="wa('Cid:<?php echo $comment['cid'] ; ?><br/>Pid:<?php echo $comment['pid'] ; ?><br/>Gid:<?php echo $comment['gid']; ?><br/>子评论楼层:<?php echo $comment['level']; ?>','评论ID信息');">查询ID</a> | <a href="javascript:;" onclick="commentReply(<?php echo $comment['cid']; ?>,this);comcrmsg.style.display='';" style="color:red;">回复此评论</a> </span></span>
						<?php if($comment['mail'] == $user_cache[1]['mail']  and $comment['mail'] != null) { echo ' <img src="'.IMG_URL.'admin.png" title="博主认证"> '; } ?>
						<span class="commentidnext"> : </span>
					</div>
					<div class="commentp">
							<?php echo html_entity_decode($comment['content'],ENT_QUOTES,'UTF-8'); ?>
						<span class="reply"> <a class="comment-reply-link" onclick="commentReply(<?php echo $comment['cid']; ?>,this);comcrmsg.style.display='';">回复</a> </span>
					</div>
				</div>
				<div class="clearline"></div>
			</div>
			<?php blog_comments_children($comments, $comment['children']);?>
		</li>
	</ul>
	<?php endforeach; ?>
<?php }?>
<?php
//blog：发表评论表单
function blog_comments_post($logid,$ckname,$ckmail,$ckurl,$verifyCode,$allow_remark){
	$CACHE = Cache::getInstance();
	$user_cache = $CACHE->readCache('user');
?>
<?php
	if($allow_remark == 'y') {
    if(!isset($_SESSION['randcc'])) {
    $_SESSION['randcc']=mt_rand();
    }
	//带有一个锚点 ?>
	<a name="comment_post"></a>
	<div style='display:none;' id='comcrmsg'><br/><a onclick="cancelReply();comcrmsg.style.display='none';" href="javascript:;"><img src="<?php echo IMG2_URL;?>info.gif"> 您当前正在回复其他评论，所以不能发表新评论。如需发表新评论，<font color="green">请点击这里</font></a></div>
	<div id="comment-place">
	<div id="comment-post" class="respond">
		<h2><span class="glyphicon glyphicon-comment" style="color:#00b0f0;font-size:23px;"></span>&nbsp;&nbsp;说点什么吧
		<button type="button" id="cancel-reply" style="display:none;float:right;" class="btn btn-default" onclick="cancelReply();comcrmsg.style.display='none';"><span class="glyphicon glyphicon-remove"></span>&nbsp;&nbsp;取消回复此评论</button></h2>

<?php
$ckname = empty($ckname) ? isset($_REQUEST['dc_name']) ? strip_tags($_REQUEST['dc_name']) : '' : strip_tags($ckname); 
$ckmail = empty($ckmail) ? isset($_REQUEST['dc_mail']) ? strip_tags($_REQUEST['dc_mail']) : '' : strip_tags($ckmail); 
$ckurl  = empty($ckurl)  ? isset($_REQUEST['dc_url'])  ? strip_tags($_REQUEST['dc_url'])  : '' : strip_tags($ckurl); 
$cktext = empty($cktext) ? isset($_REQUEST['dc_text']) ? strip_tags($_REQUEST['dc_text']) : '' : strip_tags($cktext); 
?>
		<form method="post" name="commentform" action="<?php echo BLOG_URL; ?>index.php?action=addcom" id="commentform">
			<div id="author_info">
				<input type="hidden" name="gid" value="<?php echo $logid; ?>" />
				<script type="text/javascript" src="<?php echo JS_URL;?>realgravatar.js"></script>
				<?php if(!ISLOGIN) { ?>
				<img src="http://www.gravatar.com/avatar/?s=100&d=mm&r=g" id="realtime_avatar" alt="您的头像" title="您的头像" style="width:100px;height:100px;float:right;" class="img-thumbnail">
				<div class="writerinfodiv input-group">
                    <span class="input-group-addon">昵称</span>
					<input type="text" class="form-control" name="comname" id="author" value="<?php echo $ckname; ?>" tabindex="1" autocomplete="on" placeholder="请在此填入您的昵称 [必须] | 在博客评论列表显示你的昵称" x-webkit-speech>
				</div>
				<div class="writerinfodiv input-group">
					<span class="input-group-addon">邮箱</span>
					<input type="email" class="form-control" name="commail" id="email" value="<?php echo $ckmail; ?>" tabindex="2" autocomplete="on" placeholder="请在此填入您的邮箱 [可选] | 显示头像 | 接收评论回复通知" onkeyup="realtime_grv_key();" onmousemove="realtime_grv_key();">
				</div>
				<div class="writerinfodiv input-group">
					<span class="input-group-addon">站点</span>
				<input type="url" class="form-control" name="comurl" id="url" value="<?php echo $ckurl; ?>" tabindex="3" autocomplete="on" placeholder="请在此填入您的站点 [可选] | 只允许博客站点填写！">
				</div><br/><?php }  else {
					$CACHE = Cache::getInstance();
			$user_cache = $CACHE->readCache('user');
			?>
			<img src="<?php echo preg_replace('/thum(.*)-/','',$user_cache[UID]['photo']['src']); ?>" alt="您的头像" title="您的头像" style="width:100px;height:100px;float:right;" class="img-thumbnail">
			<b><font color="#FF791D">已登录用户</font>：</b><?php echo $user_cache[UID]['name']; ?>&nbsp;&nbsp;[&nbsp;UID:<?php echo UID; ?>&nbsp;]
			<br/><br/><?php } ?>
				<p><label for="com_jzxx"><input type="checkbox" value="8" name="com_jzxx" id="com_jzxx" 
				<?php if (isset($_COOKIE["WMZZ_BLOG_LOGCOM_JZXX"])) { echo 'checked="checked" title="您之前已经选择记住信息"' ; } 
if (empty($_COOKIE["WMZZ_BLOG_LOGCOM_JZXX"]) && !isset($_REQUEST['nojzxx'])) { 
echo 'checked="checked" title="选择此项，可以使您下一次在本博客发表评论时不需要手动输入上述信息！"' ;}
 ?>>&nbsp;&nbsp;记住我的信息</label> | <a onclick="qqcon();" href="javascript:;">填入QQ号快速填写上述信息</a> | <a onclick="(function(q){q?q.toggle():function(d,j){j=d.createElement('script');j.async=true;j.src='//ime.qq.com/fcgi-bin/getjs';j.setAttribute('ime-cfg','lt=2');d=d.getElementsByTagName('head')[0];d.insertBefore(j,d.firstChild)}(document)})(window.QQWebIME)" href="javascript:;">启动QQ拼音云输入法</a></p><br/>
				<?php echo '<label for="list"><input type="checkbox" value="7525" id="list" name="list" required="required" autocomplete="on" required title="发表评论确认框：请勾选我再发表评论！"';
				if (isset($_COOKIE["WMZZ_BLOG_LOGCOM_CHECKBOX"])) { echo 'checked="checked"'; }?>>&nbsp;&nbsp;<font color="red">请勾选我再发表评论！　　　　　　　　　　　　　　　　</font></label>
				<p><br/><div id="editor_init"></div><br/>
				<textarea  name="comment" class="form-control" onclick="$(this).focus(function(){this.style.background = '';});$(this).blur(function(){if($(this).val() == ''){this.style.background = 'url(<?php echo IMG_URL;?>gay.png) no-repeat center #FFF';}});" type="text/plain" id="write_comment_textarea" style="width:100%;height:300px;background:url(<?php echo IMG_URL;?>gay.png) no-repeat center #FFF;"><?php echo $cktext; ?></textarea>
				</p>
				<p><span id="verify"><?php echo $verifyCode; ?></span>
				<br/><button type="submit" class="btn btn-success" id="comment_submit" tabindex="6" style="width:222px;"/><span class="glyphicon glyphicon-flag"></span>　发表评论</button>
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="comsys"></span></p>
				<br/><p><input type="reset" value="重置评论表单" onClick="quest('您确实要重置评论表单吗？')">
				<?php if (isset($_COOKIE["WMZZ_BLOG_LOGCOM_CHECKBOX"])) { echo '　　　　　<a href="'.BLOG_URL.'delcook.php?act=comment" onClick="quest(\'您确实要清除评论内容 Cookies 吗？\\n警告：昵称,邮箱,站点 的自动完成的内容都将被清除！\')">清除评论 Cookies</a><font style="float:right;">'.$ckname.'  欢迎回到 无名智者个人博客</font>'; } else {echo '<font style="float:right;">看来您好像还没有在 无名智者个人博客 发布过评论呦，欢迎 ^.^</font>' ;}; ?></font></p>
				<input type="hidden" name="pid" id="comment-pid" value="0" tabindex="1"/>
			</div>
		</form>
		<iframe width="0" height="0" name="cpif"></iframe>
	</div><!--end #comment-post-->
	</div><!--end #comment-place-->
	<?php 
	if (CEDITOR_URL != false) { 
		
	}
	
	} else { echo '<div style="font-size:112%;" ><br/><img src="'.BLOG_URL.'content/templates/Super-Ublog-Black/images/info.gif" alt="信息"> 该日志的评论功能已被禁用</div>'; } ?>
<?php } ?>

<?php 
//侧边栏获取日志输出
function sideBlogList($way = "new",$num=10){
	$date = time() - 3600 * 24;
	if($way=="new"){//最新发表
        $order = "hide='n' and type='blog' ORDER BY date DESC";
	}elseif($way=="rand"){//随机
        $order = "hide='n' and type='blog' ORDER BY rand()";
    }elseif($way=='view'){//点击次数
		$order = "hide='n' and type='blog' ORDER BY views DESC";
	}
	$db = MySql::getInstance();
	$sql = "SELECT gid,title,date,content,excerpt FROM ".DB_PREFIX."blog WHERE $order LIMIT 0,$num";
	$log = $db->query($sql);
	while($row = $db->fetch_array($log)) {
		echo'<li><a href="'.Url::log($row['gid']).'" title="'.$row['title'].'" >'.$row['title'].'</a></li>';
	}
}?>

<?php 
//QQ分享获取日志图像
function qs_img($blogid) {
$img_autopath='http://img.ujian.cc/nice/'.rand(1,47).'.jpg';
if(!empty($blogid)) {
    $db = MySql::getInstance();
    $sql = "SELECT * FROM ".DB_PREFIX."attachment WHERE blogid=".$blogid." AND (`filepath` LIKE '%jpg' OR `filepath` LIKE '%gif' OR `filepath` LIKE '%png') ORDER BY `aid` ASC LIMIT 0,1";
    //die($sql);
    $imgs = $db->query($sql);
    $img_path = "";
    while($row = $db->fetch_array($imgs)){
         $img_path .= BLOG_URL.substr($row['filepath'],3,strlen($row['filepath']));
    }
    if (!empty($img_path)) {
    echo $img_path;
} else { 
echo $img_autopath;
} } else { 
echo $img_autopath;
} } ?>